package com.njbw.train.member.service.impl;

import com.njbw.train.member.entity.po.Member;
import com.njbw.train.member.entity.po.MemberExample;
import com.njbw.train.member.mapper.MemberMapper;
import com.njbw.train.member.service.MemberService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MemberServiceImpl implements MemberService {

    @Resource
    private MemberMapper memberMapper;

    @Override
    public int count() {
        return Math.toIntExact(memberMapper.countByExample(null));
    }

    @Override
    public void insert(Member member) {
        memberMapper.insert(member);
    }

    @Override
    public List<Member> queryByCondition(MemberExample memberExample) {
        return memberMapper.selectByExample(memberExample);
    }
}
